package client

import (
	"github.com/gogf/gf/os/glog"
	"github.com/smallnest/rpcx/client"
	"micro-server/conf"
)

var AddClient  client.XClient

func InitAddClient() {
	for i := 0; i < len(conf.MicroServerConf.Server); i ++ {
		d, err := client.NewConsulDiscovery(conf.MicroServerConf.Path[i], "ModelConf", []string{conf.MicroServerConf.Server[i]}, nil)
		if err != nil {
			glog.Fatal(err)
			return
		}
		AddClient = client.NewXClient("ModelConf", client.Failtry, client.RandomSelect, d, client.DefaultOption)
	}
}
